
/*
extract-text-webpack-plugin插件，
有了它就可以将你的样式提取到单独的css文件里，
妈妈再也不用担心样式会被打包到js文件里了。
 */
var ExtractTextPlugin = require('extract-text-webpack-plugin');

var modules={
  　
  rules: [
    {
      test: /\.js?$/,
      loader: "babel-loader",
      exclude: /node_modules/,
      options: {
        // https://github.com/babel/babel-loader#options
        compact: false,
        presets:['es2015',"stage-0",'react'],
        plugins:[
                "transform-decorators-legacy",
                ["import", [{"style": 'css', "libraryName": "antd-mobile"}]] // css  `style: true` 会加载 less 文件
                ],
        cacheDirectory: true,
        
      }
    }
    , {
        test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/,
        use: ['file-loader?limit=4192&name=images/[md5:hash:base64:10].[ext]']
    }
    ,{
      test:/\.css$/,
      loader:ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })
    }
 
  ]
}

module.exports = modules